'use strict';
const dayjs = require("dayjs");
const {getDefaultModelConfig} = require("../../utils/common");

module.exports = app => {
    const { STRING, INTEGER, DATE, TINYINT, BIGINT } = app.Sequelize;
    const TravelerOrder = app.model.define(
        'TravelerOrder',
        {
            id: {type: INTEGER, primaryKey: true, autoIncrement: true},
            traveler_id: {type: INTEGER, allowNull: false, comment: '出行人ID'},
            travel_order_id: {type: INTEGER, allowNull: false, comment: '旅行订单ID'},
            status: {type: TINYINT, defaultValue: 1, comment: '状态：1-正常，0-禁用'},
            ...getDefaultModelConfig(app)
        },
        {
            tableName: 'traveler_order',
            timestamps: true,
            createdAt: 'create_time',
            updatedAt: 'update_time'
        }
    );

    // TravelerOrder.associate = function() {
    //     app.model.Business.TravelerOrder.belongsTo(app.model.Business.Traveler, {as: 'traveler', foreignKey: 'traveler_id'});
    //     app.model.Business.TravelerOrder.belongsTo(app.model.Business.TravelOrder, {as: 'travelOrder', foreignKey: 'travel_order_id'});
    //     // 关联旅游sku
    // }
    return TravelerOrder;
}; 